package com.user.mock.user;

import com.entity.user.AccessLog;
import com.entity.user.ClientType;
import com.user.mock.handler.ClientTypeHandler;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface AccessLogMapper {
    @Insert("INSERT INTO access_log(id, ip, machine_id, machine_name, " +
            "                       u_id, type, create_time, longitude, " +
            "                       latitude,address, comment) " +
            "VALUES (#{id}, #{ip}, #{machineId}, #{name}, " +
            "        #{uId}, #{type}, #{createTime}, #{longitude}, " +
            "        #{latitude}, #{address}, #{comment})")

    @Result(javaType = ClientType.class, jdbcType = JdbcType.INTEGER, typeHandler = ClientTypeHandler.class)
    void save(AccessLog accessLog);

    @Select("SELECT id FROM user limit 50000 ")
    List<String> selectId();
}
